package com.yueka.controller;

import com.yueka.pojo.R;
import com.yueka.pojo.entity.studentFollowRecord.StudentFollowRecord;
import com.yueka.service.StudentFollowRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RequestMapping("/studentFollowRecord")
@RestController
public class StudentFollowRecordController {
    @Autowired
    private StudentFollowRecordService studentFollowRecordService;

    @GetMapping("/list")
    public R list(Integer studentId) {
        try {
            return R.success(studentFollowRecordService.list(studentId));
        } catch (Exception e) {
            return R.error(e.getMessage());
        }
    }

    @PostMapping("/insert")
    public R insert(@RequestBody StudentFollowRecord studentFollowRecord) {
        try {
            studentFollowRecordService.insert(studentFollowRecord);
            return R.success();
        } catch (Exception e) {
            return R.error(e.getMessage());
        }
    }

    @PostMapping("/update")
    public R update(@RequestBody StudentFollowRecord studentFollowRecord) {
        try {
            studentFollowRecordService.update(studentFollowRecord);
            return R.success();
        } catch (Exception e) {
            return R.error(e.getMessage());
        }
    }
}
